VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "CStatusBar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Private Declare Function CreateStatusWindow Lib "comctl32.dll" (ByVal style As Long, ByVal lpszText As String, ByVal hwndParent As Long, ByVal wID As Long) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Private Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long

Private Const WM_CLOSE = &H10

Private Const WS_CHILD = &H40000000
Private Const WS_VISIBLE = &H10000000

Private Const SB_SETTEXTA As Long = &H401
Private Const SB_SETPARTS As Long = &H404

Dim hStatusBar As Long

Private Sub Class_Terminate()
    If hStatusBar Then SendMessage hStatusBar, WM_CLOSE, 0, 0
End Sub

Public Sub Create(hParent As Long)
    If hParent = 0 Then Exit Sub
    Dim bar(1) As Long
    bar(0) = 225
    bar(1) = -1
    hStatusBar = CreateStatusWindow(WS_CHILD Or WS_VISIBLE, vbNullString, hParent, 0&)
    SendMessage hStatusBar, SB_SETPARTS, 2, bar(0)
End Sub

Public Sub Destroy()
    If IsWindow(hStatusBar) Then
        SendMessage hStatusBar, WM_CLOSE, 0, 0
    End If
    hStatusBar = 0
End Sub

Public Sub SetText(ByVal szTitle As String, Optional pos As Long = 0)
    If IsWindow(hStatusBar) Then
        SendMessage hStatusBar, SB_SETTEXTA, pos, ByVal szTitle
    End If
End Sub

Public Sub pos()
    If IsWindow(hStatusBar) Then
        MoveWindow hStatusBar, 0, 0, 0, 0, True
    End If
End Sub
